import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    location: '',
    mobileInfo: '',
  },
  mutations: {
    saveLocation(state, prop) {
      state.location = prop;
    },
    saveMobileInfo(state, prop) {
      state.mobileInfo = prop;
      console.log(state);
    },
  },
  actions: {
    saveLocationAndMobileInfo: (context, { location, mobileInfo }) => {
      context.commit('saveMobileInfo', location);
      context.commit('saveLocation', mobileInfo);
    },
  },
  modules: {},
});
